package com.blueocean_health.care.management.controller;
/**
 * @author			作者:            zwg.BlueOcean
 * @date       			创建时间：2017年8月23日  下午6:07:40
 * @version  		版本号：    1.0*
 * @parameter  	* 
 * @since  			* 
 * @return  			*
 * @description	*	
 */

import com.alibaba.fastjson.JSON;
import com.blueocean_health.care.management.domain.base.ChargingRules;
import com.blueocean_health.care.management.domain.base.Department;
import com.blueocean_health.care.management.domain.base.SysResult;
import com.blueocean_health.care.management.domain.dto.SelectCareSalaryDto;
import com.blueocean_health.care.management.exception.OrderServiceException;
import com.blueocean_health.care.management.mapper.ChargingRulesMapper;
import com.blueocean_health.care.management.mapper.DepartmentMapper;
import com.blueocean_health.care.management.service.OrderInfoService;
import com.blueocean_health.care.management.service.order_service_info.SelectCareSalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


@RestController
@RequestMapping("/test")
public class APIController {

    @Autowired
    private OrderInfoService orderInfoService;
    //**************************************订单类接口**************************************
    /**
     * 1、添加订单
     * @return
     */
    @RequestMapping(value="/order/add",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult addOrder(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"orderId\": \"20170701120000123456\"\n" +
                "    }\n" +
                "}";
        return SysResult.ok(JSON.parse(data));
    }


    /**
     * 2、查询订单详情
     * @return
     */
    @RequestMapping(value="/order/query",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult getOrderDetail(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"patientName\": \"patient1\",\n" +
                "        \"patientRemark\": \"备注\",\n" +
                "        \"orderId\": \"20170707120000123654\",\n" +
                "        \"patientId\": \"tx_0000001\",\n" +
                "        \"sex\": \"1\",\n" +
                "        \"sexName\": \"男\",\n" +
                "        \"orderStatus\": \"3\",\n" +
                "        \"orderStatusName\": \"服务中\",\n" +
                "        \"admissionTime\": \"2017-05-01 12:00:00\",\n" +
                "        \"settlement\": [\n" +
                "            {\n" +
                "                \"transName\": \"现金\",\n" +
                "                \"amount\": 150,\n" +
                "                \"transType\": \"1\",\n" +
                "                \"feeName\": \"缴费\",\n" +
                "                \"time\": \"2017-05-05 12:00:00\",\n" +
                "                \"feeType\": \"1\",\n" +
                "                \"bak\": \"无\",\n" +
                "                \"receiptNumber\": \"单据号\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"createTime\": \"2017-05-05 12:00:00\",\n" +
                "        \"hospitalId\": \"1\",\n" +
                "        \"hospitalName\": \"顺义区医院\",\n" +
                "        \"phone\": \"13699245678\",\n" +
                "        \"contact\": \"contact\",\n" +
                "        \"orderDetail\": [\n" +
                "            {\n" +
                "                \"buildingNumberName\": \"A座\",\n" +
                "                \"departmentName\": \"儿科\",\n" +
                "                \"outworkerName\": \"外勤1\",\n" +
                "                \"totalPrice\": 2300,\n" +
                "                \"outworker\": \"1\",\n" +
                "                \"oneDayPrice\": 460,\n" +
                "                \"remark\": \"备注\",\n" +
                "                \"hospitalBed\": \"101-1\",\n" +
                "                \"illnessGrade\": \"1\",\n" +
                "                \"actualTotalPrice\": 2300,\n" +
                "                \"actualDayPrice\": 460,\n" +
                "                \"createTime\": \"2017-05-01 12:00:00\",\n" +
                "                \"halfDayPrice\": 300,\n" +
                "                \"nurse\": \"护士\",\n" +
                "                \"buildingNumber\": \"1\",\n" +
                "                \"beginTime\": \"2017-05-01 12:00:00\",\n" +
                "                \"endTime\": \"2017-05-05 12:00:00\",\n" +
                "                \"floorName\": \"一层\",\n" +
                "                \"headNurse\": \"护士长\",\n" +
                "                \"department\": \"1\",\n" +
                "                \"floor\": \"1\",\n" +
                "                \"day\": 5,\n" +
                "                \"workerInfo\": [\n" +
                "                    {\n" +
                "                        \"workerId\": \"1\",\n" +
                "                        \"serviceDay\": 5,\n" +
                "                        \"halfDayPay\": 180,\n" +
                "                        \"serviceId\": \"2\",\n" +
                "                        \"workerName\": \"护工1\",\n" +
                "                        \"serviceTypeName\": \"二对一\",\n" +
                "                        \"dayPay\": 230\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"workerId\": \"2\",\n" +
                "                        \"serviceDay\": 5,\n" +
                "                        \"halfDayPay\": 180,\n" +
                "                        \"serviceId\": \"2\",\n" +
                "                        \"workerName\": \"护工2\",\n" +
                "                        \"serviceTypeName\": \"二对一\",\n" +
                "                        \"dayPay\": 230\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ],\n" +
                "        \"payStatus\": \"1\",\n" +
                "        \"chargeInfos\": [\n" +
                "            {\n" +
                "                \"amountDue\": 100,\n" +
                "                \"amountActual\": 100,\n" +
                "                \"auditOpinion\": \"审批意见\",\n" +
                "                \"applicationTime\": \"2017-05-04 12:00:00\",\n" +
                "                \"auditTime\": \"2017-05-04 13:00:00\",\n" +
                "                \"auditor\": \"审批人\",\n" +
                "                \"auditResult\": \"审批结果\",\n" +
                "                \"applicant\": \"申请人\"\n" +
                "            }\n" +
                "        ]\n" +
                "    }\n" +
                "}";
        return SysResult.ok(JSON.parse(data));
    }

    /**
     *3、添加订单服务信息
     * @return
     */
    @RequestMapping(value="/order-service/add",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult addOrderServiceInfo(HttpServletRequest request){
        return SysResult.ok();
    }

    /**
     * 4、修改订单基本信息
     * @return
     */
    @RequestMapping(value="/order-base/modify",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult updateOrderbaseInfo(HttpServletRequest request){
        return  SysResult.ok();
    }

    /**
     * 5、修改订单服务信息
     * @return
     */
    @RequestMapping(value="/order-service/modify",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult updateOrderServiceInfo(HttpServletRequest request){
        return  SysResult.ok();
    }


    /**
     * 6、订单缴费、续费信息
     * @return
     */
    @RequestMapping(value="/order/fee/add",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderChargeInfo(HttpServletRequest request){
        return  SysResult.ok();
    }

    /**
     * 7、订单结算信息
     * @return
     */
    @RequestMapping(value="/order/charge",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderSettlement(HttpServletRequest request){
        return  SysResult.ok();
    }

    /**
     * 8、订单列表信息
     * @return
     */
    @RequestMapping(value="/order/list",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderList(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"serviceType\": 2,\n" +
                "                \"patientName\": \"test1\",\n" +
                "                \"orderId\": \"1503313125152172\",\n" +
                "                \"totalPrice\": 1500,\n" +
                "                \"orderStatus\": \"1\",\n" +
                "                \"orderFee\": 2000.5,\n" +
                "                \"createTime\": \"2017-01-02 10:00:00\",\n" +
                "                \"hospitalId\": 1,\n" +
                "                \"phone\": \"13699514563\",\n" +
                "                \"beginTime\": \"2017-01-02 12:00:00\",\n" +
                "                \"endTime\": \"2017-01-13 12:00:00\",\n" +
                "                \"payStatus\": \"1\",\n" +
                "                \"workers\": \"护工1,护工2,护工3\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"serviceType\": 2,\n" +
                "                \"patientName\": \"test2\",\n" +
                "                \"orderId\": \"1503313125155631\",\n" +
                "                \"totalPrice\": 1500,\n" +
                "                \"orderStatus\": \"1\",\n" +
                "                \"orderFee\": 2000.5,\n" +
                "                \"createTime\": \"2017-01-02 10:00:00\",\n" +
                "                \"hospitalId\": 1,\n" +
                "                \"phone\": \"13699514123\",\n" +
                "                \"beginTime\": \"2017-01-02 12:00:00\",\n" +
                "                \"endTime\": \"2017-01-13 12:00:00\",\n" +
                "                \"payStatus\": \"1\",\n" +
                "                \"workers\": \"护工1,护工2,护工3\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"serviceType\": 2,\n" +
                "                \"patientName\": \"test3\",\n" +
                "                \"orderId\": \"1503313125154578\",\n" +
                "                \"totalPrice\": 1500,\n" +
                "                \"orderStatus\": \"1\",\n" +
                "                \"orderFee\": 2000.5,\n" +
                "                \"createTime\": \"2017-01-02 10:00:00\",\n" +
                "                \"hospitalId\": 1,\n" +
                "                \"phone\": \"13699514789\",\n" +
                "                \"beginTime\": \"2017-01-02 12:00:00\",\n" +
                "                \"endTime\": \"2017-01-13 12:00:00\",\n" +
                "                \"payStatus\": \"1\",\n" +
                "                \"workers\": \"护工1,护工2,护工3\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return SysResult.ok(JSON.parse(data));
    }

    /**
     * 9、订单状态变更
     * @return
     */
    @RequestMapping(value="/order/status/modify",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderStateChange(HttpServletRequest request){
        return  SysResult.ok();
    }

    /**
     * 10、查询符合条件的护工列表
     * @return
     */
    @RequestMapping(value="/order/nurse/query",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderNurseSearchList(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"workStatus\": \"1\",\n" +
                "                \"workerId\": \"001\",\n" +
                "                \"sex\": \"1\",\n" +
                "                \"currentTask\": 0,\n" +
                "                \"province\": \"北京\",\n" +
                "                \"phone\": \"13699245169\",\n" +
                "                \"createTime\": \"2017-01-02 10:00:00\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"id\": 1,\n" +
                "                \"serviceYears\": 1,\n" +
                "                \"endTime\": \"2017-01-13 12:00:00\",\n" +
                "                \"workStatusName\": \"在职工作\",\n" +
                "                \"age\": 40\n" +
                "            },\n" +
                "            {\n" +
                "                \"workStatus\": \"1\",\n" +
                "                \"workerId\": \"002\",\n" +
                "                \"sex\": \"男\",\n" +
                "                \"currentTask\": 1,\n" +
                "                \"province\": \"北京\",\n" +
                "                \"phone\": \"13699240000\",\n" +
                "                \"createTime\": \"2017-01-02 10:00:00\",\n" +
                "                \"workerName\": \"护工2\",\n" +
                "                \"id\": 2,\n" +
                "                \"serviceYears\": 2,\n" +
                "                \"endTime\": \"2017-05-01 12:00:00\",\n" +
                "                \"workStatusName\": \"在职工作\",\n" +
                "                \"age\": 30\n" +
                "            },\n" +
                "            {\n" +
                "                \"workStatus\": \"1\",\n" +
                "                \"workerId\": \"003\",\n" +
                "                \"sex\": \"男\",\n" +
                "                \"currentTask\": 5,\n" +
                "                \"province\": \"北京\",\n" +
                "                \"phone\": \"13699240033\",\n" +
                "                \"createTime\": \"2017-01-02 10:00:00\",\n" +
                "                \"workerName\": \"护工3\",\n" +
                "                \"id\": 3,\n" +
                "                \"serviceYears\": 2,\n" +
                "                \"endTime\": \"2017-10-01 12:00:00\",\n" +
                "                \"workStatusName\": \"在职工作\",\n" +
                "                \"age\": 35\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return SysResult.ok(JSON.parse(data));

    }
    //**************************************护工类信息接口**************************************
    /**
     * 11、查询护工列表
     * @return
     */
    @RequestMapping(value="/nurse/list",method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderNurseList(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"workStatus\": \"1\",\n" +
                "                \"workerId\": \"001\",\n" +
                "                \"phone\": \"13699245169\",\n" +
                "                \"serviceTimes\": 34,\n" +
                "                \"workName\": \"护工1\",\n" +
                "                \"nativePlace\": [\n" +
                "                    \"130000\",\n" +
                "                    \"130200\",\n" +
                "                    \"130201\"\n" +
                "                ],\n" +
                "                \"id\": 1,\n" +
                "                \"workStatusName\": \"在职工作\",\n" +
                "                \"age\": 40\n" +
                "            },\n" +
                "            {\n" +
                "                \"workStatus\": \"1\",\n" +
                "                \"workerId\": \"002\",\n" +
                "                \"phone\": \"13699240000\",\n" +
                "                \"serviceTimes\": 34,\n" +
                "                \"workName\": \"护工2\",\n" +
                "                \"nativePlace\": [\n" +
                "                    \"130000\",\n" +
                "                    \"130200\",\n" +
                "                    \"130201\"\n" +
                "                ],\n" +
                "                \"id\": 2,\n" +
                "                \"workStatusName\": \"在职工作\",\n" +
                "                \"age\": 30\n" +
                "            },\n" +
                "            {\n" +
                "                \"workStatus\": \"1\",\n" +
                "                \"workerId\": \"003\",\n" +
                "                \"phone\": \"13699240033\",\n" +
                "                \"serviceTimes\": 34,\n" +
                "                \"workName\": \"护工3\",\n" +
                "                \"nativePlace\": [\n" +
                "                    \"130000\",\n" +
                "                    \"130200\",\n" +
                "                    \"130201\"\n" +
                "                ],\n" +
                "                \"id\": 3,\n" +
                "                \"workStatusName\": \"在职工作\",\n" +
                "                \"age\": 35\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return SysResult.ok(JSON.parse(data));

    }
    /**
     * 12、添加护工
     * @return
     */
    @RequestMapping(value="/nurse/add",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult nurseAdd(HttpServletRequest request){
        return  SysResult.ok();
    }
    /**
     * 13、修改护工
     * @return
     */
    @RequestMapping(value="/nurse/modify",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult nurseModify(HttpServletRequest request){
        return  SysResult.ok();
    }
    /**
     * 14、上传护工图片
     * @return
     */
    @RequestMapping(value="/nurse/img/upload",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult nursePicUpload(HttpServletRequest request){
        return  SysResult.ok();
    }
    //**************************************倒班信息接口*************************************
    /**
     * 15、科室修改
     * @return
     */
    @RequestMapping(value="/department/modify",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult departmentModify(HttpServletRequest request){
        return  SysResult.ok();
    }

    /**
     * 16、科室排序
     * @return
     */
    @RequestMapping(value="/department/sort",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult daySchedule(HttpServletRequest request){
        return  SysResult.ok();
    }
    //**************************************资金类信息接口*************************************
    /**
     * 17、资金信息查询
     * @return
     */
    @RequestMapping(value="/cash/query",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult cashQuery(HttpServletRequest request){
        String data="{\n" +
                "\"code\": 0,\n" +
                "\"msg\": \"success\",\n" +
                "\"data\": {\n" +
                "\"id\": 6,//记录Id\n" +
                "\"recordDay\": \"2017-08-20 00:00:00.0\",//发生时间\n" +
                "\"purpose\": \"2\",//资金用途Id\n" +
                "\"purposeName\": \"退费金额\", //资金用途名称\n" +
                "\"transType\": \"2\",//资金类型Id\n" +
                "\"transName\": \"pos机\",//资金类型名称\n" +
                "\"receiptNum\": \"20170829\",//数据单号\n" +
                "\"fee\": 1000,//金额\n" +
                "\"manager\": \"wuyanli\",//负责人\n" +
                "\"createTime\": null,\n" +
                "\"updateTime\": \"2017-08-22 15:08:11.0\",//提交时间\n" +
                "\"isActive\": null\n" +
                "}\n" +
                "}";
        return SysResult.ok(JSON.parse(data));

    }
    /**
     * 18、资金信息添加
     * @return
     */
    @RequestMapping(value="/cash/add",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult cashAdd(HttpServletRequest request){
        return  SysResult.ok();
    }
    /**
     * 19、资金信息修改
     * @return
     */
    @RequestMapping(value="/cash/modify",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult cashUpdate(HttpServletRequest request){
        return  SysResult.ok();
    }
    /**
     * 20、资金信息删除
     * @return
     */
    @RequestMapping(value="/cash/delete",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult cashDelete(HttpServletRequest request){
        return  SysResult.ok();
    }
    /**
     * 21、资金信息列表查询
     * @return
     */
    @RequestMapping(value="/cash/list",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult cashQueryList(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"manager\": \"test1\",\n" +
                "                \"receiptNum\": \"123124214323\",\n" +
                "                \"transType\": \"1\",\n" +
                "                \"transName\": \"现金\",\n" +
                "                \"createTime\": \"2017-05-12 12:00:00\",\n" +
                "                \"purpose\": \"2\",\n" +
                "                \"purposeName\": \"退费金额\",\n" +
                "                \"fee\": 200,\n" +
                "                \"id\": 1,\n" +
                "                \"recordDay\": \"2017-05-12\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"manager\": \"test2\",\n" +
                "                \"receiptNum\": \"123124211111\",\n" +
                "                \"transType\": \"1\",\n" +
                "                \"transName\": \"现金\",\n" +
                "                \"createTime\": \"2017-05-12 12:00:00\",\n" +
                "                \"purpose\": \"2\",\n" +
                "                \"purposeName\": \"退费金额\",\n" +
                "                \"fee\": 200,\n" +
                "                \"id\": 2,\n" +
                "                \"recordDay\": \"2017-05-12\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"manager\": \"test3\",\n" +
                "                \"receiptNum\": \"123124278913\",\n" +
                "                \"transType\": \"1\",\n" +
                "                \"transName\": \"现金\",\n" +
                "                \"createTime\": \"2017-05-12 12:00:00\",\n" +
                "                \"purpose\": \"2\",\n" +
                "                \"purposeName\": \"退费金额\",\n" +
                "                \"fee\": 200,\n" +
                "                \"id\": 1,\n" +
                "                \"recordDay\": \"2017-05-12\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return SysResult.ok(JSON.parse(data));

    }
    //**************************************报表类信息接口*************************************
    /**
     * 22、护工工资报表
     * @return
     */
    @RequestMapping(value="/nurse/salary/report",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult nurseSalary(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"workingDay\": \"2017-04-01\",\n" +
                "                \"workId\": \"tx_0001\",\n" +
                "                \"workName\": \"护工1\",\n" +
                "                \"patientName\": \"患者1\",\n" +
                "                \"dayPay\": \"180.00\",\n" +
                "                \"outworkerName\": \"外勤\", " +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"workingDay\": \"2017-04-11\",\n" +
                "                \"workId\": \"tx_0002\",\n" +
                "                \"workName\": \"护工2\",\n" +
                "                \"patientName\": \"患者2\",\n" +
                "                \"dayPay\": \"180.00\",\n" +
                "                \"outworkerName\": \"外勤\", " +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"workingDay\": \"2017-05-01\",\n" +
                "                \"workId\": \"tx_0003\",\n" +
                "                \"workName\": \"护工3\",\n" +
                "                \"patientName\": \"患者3\",\n" +
                "                \"dayPay\": \"180.00\",\n" +
                "                \"outworkerName\": \"外勤\", " +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return  SysResult.ok(JSON.parse(data));
    }
    /**
     * 23、订单缴费流水表
     * @return
     */
    @RequestMapping(value="/order/fee/list",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult orderChargeList(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"createTime\": \"2017-04-01\",\n" +
                "                \"amount\": \"1000\",\n" +
                "                \"summary\": \"缴费\",\n" +
                "                \"fundTypeName\": \"现金\",\n" +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"createTime\": \"2017-04-03\",\n" +
                "                \"amount\": \"500\",\n" +
                "                \"summary\": \"续费\",\n" +
                "                \"fundTypeName\": \"POS机\",\n" +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"createTime\": \"2017-04-05\",\n" +
                "                \"amount\": \"200\",\n" +
                "                \"summary\": \"退费\",\n" +
                "                \"fundTypeName\": \"现金\",\n" +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return  SysResult.ok(JSON.parse(data));
    }
    /**
     * 24、护工日表
     * @return
     */
    @RequestMapping(value="/nurse/daily-report",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult nurseDailyReport(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"departments\": 1,\n" +
                "        \"workers\": 3,\n" +
                "        \"totalPrice\": 2600.00,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"id\": 1,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"buildingNumberName\": \"A座\",\n" +
                "                \"floorName\": \"6\",\n" +
                "                \"dayPay\": 260.00,\n" +
                "                \"svrDay\": \"2017/05/01-2017/05/05\",\n" +
                "                \"bedNumber\": \"005\",\n" +
                "                \"patientName\": \"患者1\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\": 2,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"buildingNumberName\": \"A座\",\n" +
                "                \"floorName\": \"6\",\n" +
                "                \"dayPay\": 260.00,\n" +
                "                \"svrDay\": \"2017/05/06-2017/05/07\",\n" +
                "                \"bedNumber\": \"005\",\n" +
                "                \"patientName\": \"患者1\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\": 3,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"buildingNumberName\": \"A座\",\n" +
                "                \"floorName\": \"6\",\n" +
                "                \"dayPay\": 260.00,\n" +
                "                \"svrDay\": \"2017/05/08-2017/05/09\",\n" +
                "                \"bedNumber\": \"005\",\n" +
                "                \"patientName\": \"患者1\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"orderId\": \"20170501112300123456\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return  SysResult.ok(JSON.parse(data));
    }

    /**
     * 25、科室日报
     * @return
     */
    @RequestMapping(value="/department/daily-report",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult departmentDailyReport(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"patients\": 23,\n" +
                "        \"totalPrice\": 43000.00,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"id\": 1,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"admissionTime\": \"2017-05-01\",\n" +
                "                \"patientId\": \"tp89097\",\n" +
                "                \"patientName\": \"患者1\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"serviceTypeName\": \"一对一\",\n" +
                "                \"beginTime\": \"2017-05-01\",\n" +
                "                \"endTime\": \"2017-05-05\",\n" +
                "                \"day\": 5.0,\n" +
                "                \"dayPay\": 260.00,\n" +
                "                \"totalPrice\": 1300.00,\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\": 2,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"admissionTime\": \"2017-06-01\",\n" +
                "                \"patientId\": \"tp89099\",\n" +
                "                \"patientName\": \"患者2\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"serviceTypeName\": \"一对一\",\n" +
                "                \"beginTime\": \"2017-06-01\",\n" +
                "                \"endTime\": \"2017-06-05\",\n" +
                "                \"day\": 5.0,\n" +
                "                \"dayPay\": 260.00,\n" +
                "                \"totalPrice\": 1300.00,\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\": 3,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"admissionTime\": \"2017-07-01\",\n" +
                "                \"patientId\": \"tp89107\",\n" +
                "                \"patientName\": \"患者3\",\n" +
                "                \"workerName\": \"护工1\",\n" +
                "                \"serviceTypeName\": \"一对一\",\n" +
                "                \"beginTime\": \"2017-07-01\",\n" +
                "                \"endTime\": \"2017-07-05\",\n" +
                "                \"day\": 5.0,\n" +
                "                \"dayPay\": 260.00,\n" +
                "                \"totalPrice\": 1300.00,\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return  SysResult.ok(JSON.parse(data));
    }

    /**
     * 26、科室统计报表
     * @return
     */
    @RequestMapping(value="/department/count-report",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult departmentCountReport(HttpServletRequest request){
        String data="{\n" +
                "    \"code\": 0,\n" +
                "    \"msg\": \"SUCCESS\",\n" +
                "    \"data\": {\n" +
                "        \"lastPage\": 1,\n" +
                "        \"navigatepageNums\": [\n" +
                "            1\n" +
                "        ],\n" +
                "        \"startRow\": 0,\n" +
                "        \"hasNextPage\": false,\n" +
                "        \"prePage\": 0,\n" +
                "        \"nextPage\": 0,\n" +
                "        \"endRow\": 2,\n" +
                "        \"pageSize\": 3,\n" +
                "        \"departments\": 1,\n" +
                "        \"totalWorkers\": 33,\n" +
                "        \"totalPatients\": 23,\n" +
                "        \"totalPrice\": 260000.00,\n" +
                "        \"list\": [\n" +
                "            {\n" +
                "                \"id\": 1,\n" +
                "                \"departmentName\": \"眼科\",\n" +
                "                \"cost\": 2600.00,\n" +
                "                \"workers\": 10.00,\n" +
                "                \"patients\": 3.00,\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\": 2,\n" +
                "                \"departmentName\": \"内科\",\n" +
                "                \"cost\": 2600.00,\n" +
                "                \"workers\": 10.00,\n" +
                "                \"patients\": 3.00,\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\": 3,\n" +
                "                \"departmentName\": \"儿科\",\n" +
                "                \"cost\": 2600.00,\n" +
                "                \"workers\": 10.00,\n" +
                "                \"patients\": 3.00,\n" +
                "            }\n" +
                "        ],\n" +
                "        \"pageNum\": 1,\n" +
                "        \"navigatePages\": 8,\n" +
                "        \"navigateFirstPage\": 1,\n" +
                "        \"total\": 3,\n" +
                "        \"pages\": 1,\n" +
                "        \"firstPage\": 1,\n" +
                "        \"size\": 3,\n" +
                "        \"isLastPage\": true,\n" +
                "        \"hasPreviousPage\": false,\n" +
                "        \"navigateLastPage\": 1,\n" +
                "        \"isFirstPage\": true\n" +
                "    }\n" +
                "}";
        return  SysResult.ok(JSON.parse(data));
    }
    //**************************************基础信息*************************************

    @Autowired
    private SelectCareSalaryService selectCareSalaryService;

    @RequestMapping(value = "/summary", produces = MediaType.APPLICATION_JSON_VALUE)
    public SysResult queryNurseSalarySummary() throws OrderServiceException {
//		User courrentUser = LocalManager.getVal(LocalManagerType.USER_WEB);
//		String hid =  courrentUser.getHospitalId();
//		careSalaryDto.setHospitalId(hid);

        SelectCareSalaryDto careSalaryDto = new SelectCareSalaryDto();

        careSalaryDto.setBeginTime("2017-11-24");
        careSalaryDto.setEndTime("2017-11-28");
        careSalaryDto.setHospitalId("1");
        careSalaryDto.setOutWorkerKey("");
        careSalaryDto.setPatientKey("");
        careSalaryDto.setWorkerKey("");


        return selectCareSalaryService.queryNurseSalarySummary(careSalaryDto);
    }




    @Autowired
    private ChargingRulesMapper rulesMapper;
    @Autowired
    private DepartmentMapper departmentMapper;

    @RequestMapping(value="/insertChargingRulesData",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
    @Transactional
    public SysResult insertChargingRulesData(){

        String hId3 = "3";
        String hId4 = "4";
        //服务类型id
        String[]  services = {"38","39","40","41"};

        //三家医院的病情级别id
        String[]  fourllness = {"196","197"};
        String[]  fivetllness = {"198","199","200","201"};
        List<Department> allforthree = departmentMapper.getAllByHospitalIdForSort(hId3);
        List<Department> allforfour = departmentMapper.getAllByHospitalIdForSort(hId4);

        //id为3的沈阳医大一
        for (int i = 0; i < allforthree.size(); i++) {

            for (int j = 0; j < services.length ; j++) {

                for (int k = 0; k <fourllness.length ; k++) {
                    ChargingRules chargingRules = new ChargingRules();
                    chargingRules.setDeptId(allforthree.get(i).getDeptId()+"");
                    chargingRules.setCancel("0");

                    chargingRules.setServiceId(services[j]);

                    String llness = fourllness[k];
                    chargingRules.setIllnessId(llness);

                    if ("196".equals(llness)){

                        chargingRules.setOneDayPay(280.0);
                        chargingRules.setOneHourPay(280.0/24);
                        chargingRules.setNurseDayPay(280.0*0.8);
                        chargingRules.setNurseHourPay(280.0*0.8/24);

                    }else {
                        chargingRules.setOneDayPay(260.0);
                        chargingRules.setOneHourPay(260.0/24);
                        chargingRules.setNurseDayPay(260.0*0.8);
                        chargingRules.setNurseHourPay(260.0*0.8/24);
                    }

                    rulesMapper.insert(chargingRules);
                }
            }
        }

        //id为4的陆军总院
        for (int i = 0; i < allforfour.size(); i++) {

            for (int j = 0; j < services.length ; j++) {

                for (int k = 0; k <fivetllness.length ; k++) {
                    ChargingRules chargingRules = new ChargingRules();
                    chargingRules.setDeptId(allforfour.get(i).getDeptId()+"");
                    chargingRules.setCancel("0");

                    chargingRules.setServiceId(services[j]);

                    String llness = fivetllness[k];
                    chargingRules.setIllnessId(llness);

                    if ("198".equals(llness)){

                        chargingRules.setOneDayPay(150.0);
                        chargingRules.setOneHourPay(150.0/24);
                        chargingRules.setNurseDayPay(150.0*0.8);
                        chargingRules.setNurseHourPay(150.0*0.8/24);

                    }else if("199".equals(llness)){
                        chargingRules.setOneDayPay(200.0);
                        chargingRules.setOneHourPay(200.0/24);
                        chargingRules.setNurseDayPay(200.0*0.8);
                        chargingRules.setNurseHourPay(200.0*0.8/24);
                    }else if("200".equals(llness)){
                        chargingRules.setOneDayPay(250.0);
                        chargingRules.setOneHourPay(250.0/24);
                        chargingRules.setNurseDayPay(250.0*0.8);
                        chargingRules.setNurseHourPay(250.0*0.8/24);
                    }else{
                        chargingRules.setOneDayPay(300.0);
                        chargingRules.setOneHourPay(300.0/24);
                        chargingRules.setNurseDayPay(300.0*0.8);
                        chargingRules.setNurseHourPay(300.0*0.8/24);
                    }

                    rulesMapper.insert(chargingRules);
                }
            }
        }
        return SysResult.ok();
    }


}


